<template>
  <div>
    <h3>新增销售员</h3>
    <p>姓名 <input type="text" v-model="salesmans.name" /></p>
    <p>账号 <input type="text" v-model="salesmans.account" /></p>
    <p>密码 <input type="text" v-model="salesmans.password" /></p>
    <button @click="addSalesmans(salesmans)">确认新增</button>
  </div>
</template>

 

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions } = createNamespacedHelpers("salesmans");
export default {
  data() {
    return {
      salesmans: {
        name: "",
        account: "",
        password: "",
      },
    };
  },
  methods: {
    ...mapActions(["addSalesmans"]),
  },
};
</script>
